import { stringify } from 'qs';
import request from '@/utils/request';

export async function queryProjectNotice() {
  return request('/api/project/notice');
}

export async function queryActivities() {
  return request('/api/activities');
}

export async function queryRule(params) {
  return request(`/api/rule?${stringify(params)}`);
}

export async function removeRule(params) {
  return request('/api/rule', {
    method: 'POST',
    body: {
      ...params,
      method: 'delete',
    },
  });
}

export async function addRule(params) {
  return request('/api/rule', {
    method: 'POST',
    body: {
      ...params,
      method: 'post',
    },
  });
}

export async function updateRule(params) {
  return request('/api/rule', {
    method: 'POST',
    body: {
      ...params,
      method: 'update',
    },
  });
}

export async function fakeSubmitForm(params) {
  return request('/api/forms', {
    method: 'POST',
    body: params,
  });
}

export async function fakeChartData() {
  return request('/api/fake_chart_data');
}

export async function queryTags() {
  return request('/api/tags');
}

export async function queryBasicProfile() {
  return request('/api/profile/basic');
}

export async function queryAdvancedProfile() {
  return request('/api/profile/advanced');
}

export async function queryFakeList(params) {
  return request(`/api/fake_list?${stringify(params)}`);
}

export async function removeFakeList(params) {
  const { count = 5, ...restParams } = params;
  return request(`/api/fake_list?count=${count}`, {
    method: 'POST',
    body: {
      ...restParams,
      method: 'delete',
    },
  });
}

export async function addFakeList(params) {
  const { count = 5, ...restParams } = params;
  return request(`/api/fake_list?count=${count}`, {
    method: 'POST',
    body: {
      ...restParams,
      method: 'post',
    },
  });
}

export async function updateFakeList(params) {
  const { count = 5, ...restParams } = params;
  return request(`/api/fake_list?count=${count}`, {
    method: 'POST',
    body: {
      ...restParams,
      method: 'update',
    },
  });
}

export async function fakeRegister(params) {
  return request('/api/register', {
    method: 'POST',
    body: params,
  });
}

export async function queryInitNotices(params = {}) {
  return request('/mgrApi/sysMsg/pageInitList', {
    method: 'POST',
    body: params,
  });
}

export async function getNoticeNum(params) {
  return request('/mgrApi/sysMsg/pageSendTypeCount', {
    method: 'POST',
    body: params,
  });
}

export async function queryNotices(params = {}) {
  return request('/mgrApi/sysMsg/pageList', {
    method: 'POST',
    body: params,
  });
}

// 判断是否登录
export async function isLogin() {
  return request('/ssoApi/baselogin/base/isExistSession', {
    method: 'POST',
  });
}

// 登录
export async function login(params) {
  return request('/ssoApi/baselogin/login', {
    method: 'POST',
    body: params,
  });
}

// 获取登录后权限信息
export async function fetchAuthorityList(params) {
  return request('/ssoApi/menu/permsList', {
    method: 'POST',
    body: params,
  });
}

// 获取登录后权限信息
// eslint-disable-next-line no-unused-vars
export async function logout(params) {
  return request('/ssoApi/baselogin/loginOut', {
    method: 'POST',
  });
}
// 员工运行客户名称模糊查询
export async function getCustEsOsList(params) {
  return request('/mgrApi/mgrMdCust/likeName', {
    method: 'POST',
    body: params,
  });
}

// 获取字典：
export async function getDictCode(params) {
  return request('/csApi/mdm/nmDict/queryDictItemsByCodes', {
    method: 'POST',
    body: params,
  });
}

// 模糊查询地区
export async function getAreaList(params) {
  return request('/csApi/mdm/nmArea/queryNmArea', {
    method: 'POST',
    body: params,
  });
}

// 模糊客户名称：有效
export async function getCustList(params) {
  return request('/csApi/custInfo/likeName', {
    method: 'POST',
    body: params,
  });
}
// 模糊配置名称：有效
export async function getConfigList(params) {
  return request('/csApi/custService/getCustConfName', {
    method: 'POST',
    body: params,
  });
}

// 模糊客户名称:所有
export async function getCustAllList(params) {
  return request('/csApi/custInfo/pageList', {
    method: 'POST',
    body: params,
  });
}

// 模糊供应商系统：客户名称
export async function getNsCustList(params) {
  return request('/nsApi/customer/mdCustList', {
    method: 'POST',
    body: params,
  });
}

// 供应商系统：发单管理：客户名称
export async function getSendOrderCustList(params) {
  return request('/nsApi/customer/corpCustList', {
    method: 'POST',
    body: params,
  });
}

// 供应商系统：发接单管理：接单方 或者签约方
export async function getSendRecvSuppList(params) {
  return request('/nsApi/supplier/querySuppList', {
    method: 'POST',
    body: params,
  });
}

// 获取供应商名称
export async function getSupplyList(params) {
  return request('/csApi/supplier/mgrListByUser', {
    method: 'POST',
    body: params,
  });
}

// 获取供应商名称
// export async function getNsSupplyList(params) {
//   return request('/nsApi/supplier/getListByUser', {
//     method: 'POST',
//     body: params,
//   });
// }
export async function getNsSupplyList(params) {
  return request('/nsApi/supplier/querySuppList', {
    method: 'POST',
    body: params,
  });
}

// 获取供应商帐单下的签约方:客服系统
export async function getBillSupplyList(params) {
  return request('/csApi/supplier/contSuppList', {
    method: 'POST',
    body: params,
  });
}

// 获取客户合同名称
export async function getContList(params) {
  return request('/csApi/custCont/contNameList', {
    method: 'POST',
    body: params,
  });
}

// 获取供应商合同名称
export async function getSuppContList(params) {
  return request('/csApi/suppCont/getNameList', {
    method: 'POST',
    body: params,
  });
}

// 获取报价单名称
export async function getQuoList(params) {
  return request('/csApi/crmquo/getList', {
    method: 'POST',
    body: params,
  });
}

// 上传文件
export async function uploadFile(url, params) {
  return request(url, {
    method: 'POST',
    body: params,
  });
}
// 模糊查询员工姓名
export async function getEmpNameList(params) {
  return request('/esApi/insCardHdl/getEmpList', {
    method: 'POST',
    body: params,
  });
}

// 获取材料
export async function getMatList(params) {
  return request('/esApi/insCardHdl/getMatTemplate', {
    method: 'POST',
    body: params,
  });
}

export async function getFileName(params) {
  return request('/esApi/fileServer/downloadTemplate', {
    method: 'POST',
    body: params,
  });
}
// 获取服务类型（服务办理）
export async function getServiceType(params) {
  return request(`/osApi/plcyDataDict/entrySerTypeList`, {
    method: 'POST',
    body: params,
  });
}

// 获取服务类型
export async function getProType(params) {
  return request(`/osApi/plcyDataDict/queryProbTypeList`, {
    method: 'POST',
    body: params,
  });
}

// 标记问题人员
export async function signPro(params) {
  return request(`/osApi/problem/ins/signProbFlag`, {
    method: 'POST',
    body: params,
  });
}

// 问题人员列表
export async function getProList(params) {
  return request(`/osApi/problem/ins/pageList`, {
    method: 'POST',
    body: params,
  });
}

// 消息通知修改已读未读
export async function updateState(params) {
  return request(`/osApi/sysMsg/updateSignState`, {
    method: 'POST',
    body: params,
  });
}

// 获取跳转页面
export async function getUrl(params) {
  return request(`/esApi/sysMsg/getMsgUrl`, {
    method: 'POST',
    body: params,
  });
}

// 获取消息总数
export async function getNoticeCount(params) {
  return request(`/mgrApi/sysMsg/pageCount`, {
    method: 'POST',
    body: params,
  });
}

// 修改所有消息状态
export async function clearAllNotice(params) {
  return request(`/mgrApi/sysMsg/updateSignAll`, {
    method: 'POST',
    body: params,
  });
}

// 获取服务类型
// 获取服务类型列表
export async function getServiceDictList(params) {
  return request(`/mgrApi/plcyDataDict/entrySerTypeList`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

export async function fetchAssoCustomer(params) {
  return request(`/mgrApi/mgrMdCust/likeName`, {
    method: 'POST',
    body: params,
  });
}
// 报价单信息
export async function getQuoInfo(params) {
  return request(`/csApi/crmquo/get`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
// 社保账户详情信息 单立户
export async function getInsDetailInfo(params) {
  return request(`/csApi/custInsAcco/get`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
// 社保账户信息 单立户 企业工伤比例
export async function fetchInjRatioPage(params) {
  return request(`/csApi/custInsAcco/getInjRatioPage`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
// 社保账户详情信息 大库
export async function getDetailInforPage(params) {
  return request(`/mgrApi/suppIns/get`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
// 公积金账户详情信息 单立户
export async function getAccuDetailInfo(params) {
  return request(`/csApi/custAccuAcco/get`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}
// 公积金账户详情信息 大库
export async function getDetailAccuPage(params) {
  return request(`/mgrApi/suppAccu/get`, {
    method: 'POST',
    body: {
      ...params,
    },
  });
}

// 获取缴费人员类别
export async function getJoinIdeList(params) {
  return request(`/nsApi/joinIde/list`, {
    method: 'POST',
    body: params,
  });
}

// 获取社保政策详情
export async function getInsDetailData(params) {
  return request(`/nsApi/insLsPkg/getInsLsPkg`, {
    method: 'POST',
    body: params,
  });
}

// 获取险种下的详情
export async function getPdIdDetailData(params) {
  return request(`/nsApi/insLsPkg/queryLocStd`, {
    method: 'POST',
    body: params,
  });
}

// 获取公积金政策详情
export async function getAccuDetailData(params) {
  return request(`/nsApi/accuLsPkg/queryLocStdInfo`, {
    method: 'POST',
    body: params,
  });
}

// 获取公积金组合详情
export async function getAccuLsPkgDetailData(params) {
  return request(`/nsApi/accuLsPkg/getAccuLsPkg`, {
    method: 'POST',
    body: params,
  });
}

// 获取工伤二级户弹框详情
export async function getInjSecAccoDetailData(params) {
  return request(`/mgrApi/injSecAccoApi/getInfo`, {
    method: 'POST',
    body: params,
  });
}

// 获取websocket token
export async function getSocketToken(params) {
  return request(`/ssoApi/baselogin/getToken`, {
    method: 'POST',
    body: params,
  });
}

// 模糊客户名称：员工系统一次性费用新增客户
export async function getEsOnceCustList(params) {
  return request('/csApi/custInfo/getCorpCust', {
    method: 'POST',
    body: params,
  });
}
// 通过证件号查询员工列表
export async function getIdCodeEmpList(url, params) {
  return request(url, {
    method: 'POST',
    body: params,
  });
}

export async function getEsPersonList(params) {
  return request('/mgrApi/user/queryUserByOrgId', {
    method: 'POST',
    body: params,
  });
}

export async function getOsAccoList(params) {
  return request('/osApi/basicUser/listUserById', {
    method: 'POST',
    body: params,
  });
}
